<?php
/**
 * LowCalVanilla Functions tests
 *
 * @package Extensions
 * @subpackage test
 * @copyright Damien Lebrun 2007
 * @author Damien Lebrun
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GPLv2
 */

//require_once('simpletest/unit_tester.php');
//require_once('simpletest/reporter.php');
require_once(dirname(__File__).'/../src/Functions.php');

/**
 * LowCalVanilla Functions tests
 * @package Extensions
 */
class TestFunctions extends UnitTestCase {

	function testIsGzipIncompatibleClient() {
		unset($_SERVER['HTTP_USER_AGENT']);
		$this->assertFalse(IsGzipIncompatibleClient(false));
		$this->assertTrue(IsGzipIncompatibleClient(true));
		//test IE7
		$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)';
		$this->assertFalse(IsGzipIncompatibleClient());
		//test IE6 sp2
		$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; NeosBrowser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)';
		$this->assertFalse(IsGzipIncompatibleClient());
		$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0 (compatible- MSIE 6.0- Windows NT 5.1- SV1- .NET CLR 1.1.4322';
		$this->assertFalse(IsGzipIncompatibleClient());
		//test IE6 (non sp2)
		$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Deepnet Explorer 1.5.0; .NET CLR 1.0.3705)';
		$this->assertTrue(IsGzipIncompatibleClient());
		//test IE5.5
		$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)';
		$this->assertTrue(IsGzipIncompatibleClient());
	}
}